package com.vietnam.power.persitence;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * The persistent class for the file_upload database table.
 * 
 */
@Entity
@Table(name = "file_upload")
public class FileUpload implements Serializable {
	private static final long serialVersionUID = 1L;
	private int id;
	private String fileName;
	private String name;
	private String thumbName;
	private boolean status;
	private String description;
	private List<ProductImage> productImages;
	private List<ArticleImage> articleImages;
	private List<UserInfo> avatarImages;

	public FileUpload() {
	}

	public FileUpload(int id) {
		this.id = id;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Column(name = "file_name")
	public String getFileName() {
		return this.fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "thumb_name")
	public String getThumbName() {
		return this.thumbName;
	}

	public void setThumbName(String thumbName) {
		this.thumbName = thumbName;
	}

	@Column(name = "status")
	public boolean getStatus() {
		return status;
	}

	public void setStatus(boolean status) {
		this.status = status;
	}

	@Column(name = "description")
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	// bi-directional many-to-one association to ProductImage
	@OneToMany(mappedBy = "fileUpload")
	public List<ProductImage> getProductImages() {
		return this.productImages;
	}

	public void setProductImages(List<ProductImage> productImages) {
		this.productImages = productImages;
	}

	public ProductImage addProductImage(ProductImage productImage) {
		getProductImages().add(productImage);
		productImage.setFileUpload(this);

		return productImage;
	}

	public ProductImage removeProductImage(ProductImage productImage) {
		getProductImages().remove(productImage);
		productImage.setFileUpload(null);

		return productImage;
	}

	@OneToMany(mappedBy = "avatarId")
	public List<UserInfo> getAvatarImages() {
		return avatarImages;
	}

	public void setAvatarImages(List<UserInfo> avatarImages) {
		this.avatarImages = avatarImages;
	}

	// bi-directional many-to-one association to ProductImage
	@OneToMany(mappedBy = "fileUpload")
	public List<ArticleImage> getArticleImages() {
		return this.articleImages;
	}

	public void setArticleImages(List<ArticleImage> articleImages) {
		this.articleImages = articleImages;
	}

	public ArticleImage addArticleImage(ArticleImage articleImages) {
		getArticleImages().add(articleImages);
		articleImages.setFileUpload(this);

		return articleImages;
	}

	public ArticleImage removeArticleImage(ArticleImage articleImages) {
		getArticleImages().remove(articleImages);
		articleImages.setFileUpload(null);

		return articleImages;
	}
}